{% extends 'base.html' %}

{% block title %}视频数据分析折线图{% endblock %}

{% block head %}
{% endblock %}

{% block body %}
    <div class="container">
        <div id="line"  style="width:1000px; height:600px;"></div>
    </div>
{% endblock %}

{% block js %}
    <script>
        var chart = echarts.init(document.getElementById('line'), 'white', {renderer: 'canvas'});

        $(function () {
                fetchData(chart);
                setInterval(fetchData, 1000 * 60 * 60);
            }
        )

        function fetchData() {
            $.ajax({
                type: "GET",
                url: "http://127.0.0.1:5000/analysis/get_line_chart/{{ bvid }}",
                dataType: 'json',
                success: function (result) {
                    chart.setOption(result);
                }
            });
        }
    </script>
{% endblock %}
